@set path=C:\OpenSSL-Win32\bin;%path%

copy out\ca.key ca.key
copy out\ca.crt ca.crt
rd /s /q out
rd /s /q temp
mkdir out
mkdir temp
copy ca.key out\ca.key
copy ca.crt out\ca.crt
del ca.key
del ca.crt

echo y>temp\yy.txt
echo y>>temp\yy.txt

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Server side
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
set key_file_name=server
:: generate key
openssl genrsa -out out\%key_file_name%.key

:: generate server_localhost.csr
set file=server_localhost
openssl req -new -key out\%key_file_name%.key -out temp\%file%.csr -config openssl.cfg
CN
GuangXi
Guilin
T Community
Technology Department
localhost
475647575@qq.com



:: sign it by ourself
type temp\yy.txt|openssl ca -in temp\%file%.csr -out out\%file%.crt -cert out\ca.crt -keyfile out\ca.key -config openssl.cfg -days 365
0403
y
y
copy demoCA\newcerts\01.pem out\%file%.crt /y

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

:: generate server_all.csr
set file=server_all
openssl req -new -key out\%key_file_name%.key -out temp\%file%.csr -config openssl.cfg
CN
GuangXi
Guilin
T Community
Technology Department
*
475647575@qq.com


:: sign it by ourself
type temp\yy.txt|openssl ca -in temp\%file%.csr -out out\%file%.crt -cert out\ca.crt -keyfile out\ca.key -config openssl.cfg -days 365
0403
y
y
::copy demoCA\newcerts\02.pem out\%file%.crt /y

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

:: generate server_119_29_159_124.csr
set file=server_119_29_159_124
openssl req -new -key out\%key_file_name%.key -out temp\%file%.csr -config openssl.cfg
CN
GuangXi
Guilin
T Community
Technology Department
119.29.159.124
475647575@qq.com


:: sign it by ourself
type temp\yy.txt|openssl ca -in temp\%file%.csr -out out\%file%.crt -cert out\ca.crt -keyfile out\ca.key -config openssl.cfg -days 365
0403
y
y
copy demoCA\newcerts\03.pem out\%file%.crt /y


:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::


:: generate server_weizehua_vicp_cc.csr
set file=server_weizehua_vicp_cc
openssl req -new -key out\%key_file_name%.key -out temp\%file%.csr -config openssl.cfg
CN
GuangXi
Guilin
T Community
Technology Department
weizehua.vicp.cc
475647575@qq.com


:: sign it by ourself
type temp\yy.txt|openssl ca -in temp\%file%.csr -out out\%file%.crt -cert out\ca.crt -keyfile out\ca.key -config openssl.cfg -days 365
0403
y
y
copy demoCA\newcerts\04.pem out\%file%.crt /y


:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::






::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Client side
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
set key_file_name=client
:: generate key
openssl genrsa -out out\%key_file_name%.key


:: generate client.csr
set file=client
openssl req -new -key out\%key_file_name%.key -out temp\%file%.csr -config openssl.cfg
CN
GuangXi
Guilin
T Community
Technology Department
TCommunity Client
475647575@qq.com


:: sign it by ourself
type temp\yy.txt|openssl ca -in temp\%file%.csr -out out\%file%.crt -cert out\ca.crt -keyfile out\ca.key -config openssl.cfg
0403
y
y
copy demoCA\newcerts\05.pem out\%file%.crt /y


:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

